<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="../plugins/layui-v2.6.8/layui/css/layui.css?v=${.Config.basic.version}" media="all">
    <link rel="stylesheet" href="../plugins/layui/css/style.css?v=${.Config.basic.version}" media="all">
    <link rel="stylesheet" href="../layuiadmin/style/admin.css?v=${.Config.basic.version}" media="all">
    <link rel="stylesheet" href="../plugins/zTree/css/metroStyle/metroStyle.css?v=${.Config.basic.version}">
    <link rel="stylesheet" href="../plugins/zTree/css/metroStyle/ext.css?v=${.Config.basic.version}">
    <link rel="stylesheet" href="//at.alicdn.com/t/c/font_3564966_a6tt4yhnzge.css" media="all">
    <link rel="stylesheet" href="../plugins/toastr/toastr.min.css?v=${.Config.basic.version}">

    <link rel="stylesheet" href="../plugins/jquery-step/jquery.step.css?v=${.Config.basic.version}" media="all">
    <style>
        .layui-table-view .layui-table td, .layui-table-view .layui-table th {
            padding: 5px 0;
            border-top: 1px solid #404453;
            border-left: 1px solid #404453;
            border-bottom: 1px solid #404453;
            border-right: 1px solid #404453;
        }
        .layui-table-cell {
            line-height: 20px !important;
            vertical-align: middle;
            height: auto;
            overflow: visible;
            text-overflow: inherit;
            white-space: normal;
        }
        .layui-table-view .layui-table[lay-size="sm"] .layui-table-cell {
            line-height: 20px !important;
            vertical-align: middle;
            height: auto;
            overflow: visible;
            text-overflow: inherit;
            white-space: normal;
        }
    </style>
    <style>
        .layui-form-label-lg {
            width: 150px;
        }

        .ui-step-wrap .ui-step .ui-step-item div {
            text-align: center;
            color: #899eb2;
        }
        button {
            display: inline-block;
            padding: 6px 12px;
            font-size: 14px;
            line-height: 1.42857143;
            text-align: center;
            cursor: pointer;
            border: 1px solid transparent;
            border-radius: 4px;
            color: #fff;
            background-color: #4958b9;
        }
        
        .main {
            width: 750px;
            margin: 10px auto;
        }
        
        #step {
            margin-bottom: 20px;
        }
        
        .btns {
            float: left;
        }
        
        .info {
            float: left;
            height: 34px;
            line-height: 34px;
            margin-left: 40px;
            font-size: 28px;
            font-weight: bold;
            color: #928787;
        }
        
        .info span {
            color: red;
        }

        .layui-form-item .layui-input[readonly] {
            background-color: #0a1434 !important;
            color: #f9fafd;
        }
    </style>
</head>
<body>

    <div class="layui-card">
        <div class="layui-card-body">
            <form class="layui-form" lay-filter="form_search" id="form_search" action="">
                <div class="layui-form-item">


                    <div class="layui-inline">
                        <label class="layui-form-label auto-size-label">设备SN:</label>
                        <div class="layui-input-inline">
                            <input type="text" name="sn" placeholder="请输入设备SN码" lay-verify="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline">
                        <button type="submit" class="layui-btn layui-btn-sm layui-btn-normal" lay-submit="" lay-filter="btn_search"><i class="layui-icon layui-icon-search"></i>查询</button>
                        <!--<button type="button" class="layui-btn layui-btn-normal layui-btn-sm action-export layui-hide" lay-submit="" lay-filter="btn_search"><i class="fa fa-file-excel-o"></i> 导出</button>-->
                    </div>

                </div>
            </form>

            <form class="layui-form " lay-filter="form_gw" id="form_gw" style="display: none; padding: 20px;">
                <blockquote class="layui-elem-quote" >
                    分布式智能网关
                </blockquote>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> 集团区域</label>
                        <div class="layui-input-inline">
                            <input type="text" name="group_area" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> 场区</label>
                        <div class="layui-input-inline">
                            <input type="text" name="farmname" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> 单元</label>
                        <div class="layui-input-inline">
                            <input type="text" name="housename" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> ID</label>
                        <div class="layui-input-inline">
                            <input type="text" name="id" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> SN</label>
                        <div class="layui-input-inline">
                            <input type="text" name="device_addr" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> 版本</label>
                        <div class="layui-input-inline">
                            <input type="text" name="version" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> 状态</label>
                        <div class="layui-input-inline">
                            <input type="text" name="alive" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> 最后数据</label>
                        <div class="layui-input-inline">
                            <input type="text" name="lasttime" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                </div>
            </form>


            <form class="layui-form " lay-filter="form_feed" id="form_feed" style="display: none;padding: 20px;">
                <blockquote class="layui-elem-quote" >
                    智能精准饲喂
                </blockquote>
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> 集团区域</label>
                        <div class="layui-input-inline">
                            <input type="text" name="group_area" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> 场区</label>
                        <div class="layui-input-inline">
                            <input type="text" name="farmname" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> 单元</label>
                        <div class="layui-input-inline">
                            <input type="text" name="housename" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> 智能网关</label>
                        <div class="layui-input-inline">
                            <input type="text" name="addr" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> SN</label>
                        <div class="layui-input-inline">
                            <input type="text" name="sn" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> 栏位</label>
                        <div class="layui-input-inline">
                            <input type="text" name="hnum" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> 版本</label>
                        <div class="layui-input-inline">
                            <input type="text" name="version" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> 最后数据</label>
                        <div class="layui-input-inline">
                            <input type="text" name="lasttime" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-inline">
                        <label class="layui-form-label layui-form-label-large"> 初次激活</label>
                        <div class="layui-input-inline">
                            <input type="text" name="first_online" readonly value="" lay-verify="required" lay-verType="tips" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    
                </div>


            </form>

        </div>
    </div>

    

    



</body>


<script src="../plugins/jquery/jquery-3.6.0.js?v=${.Config.basic.version}"></script>
<script src="../plugins/layui-v2.6.8/layui/layui.js"></script>
<script src="../plugins/jquery.slimscroll.min.js"></script>
<script src="../plugins/toastr/toastr.min.js"></script>
<script src="../plugins/moment.min.js"></script>
<script src="../plugins/jquery-step/jquery.step.min.js?v=${.Config.basic.version}"></script>
<script src="../js/utils.js?v=${.Config.basic.version}"></script>
<script src="../js/func.js?v=${.Config.basic.version}"></script>
<script>
    var table=null;
    var form=null;
    var Table=null;
    var element = null;
    var sys_roles=null;
    var lay_index = null;
    var token = window.localStorage.getItem("token");
    var user_info=JSON.parse(window.localStorage.getItem("user_info"));
    var dictionary=JSON.parse(window.localStorage.getItem("dictionary"));
    var func_url="${.func_url}";
    var actions=[];
    token = 'Bearer ' + token;

    var $step = null;

    layui.config({
        base: '../layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','layer','form', 'table','transfer','laydate','element','dropdown'],function(){

        $ = layui.$;
        form = layui.form;
        table = layui.table;
        element = layui.element;

        toastr.options = {
            "closeButton": false, //是否显示关闭按钮
            "debug": false, //是否使用debug模式
            "positionClass": "toast-top-center",//弹出窗的位置
            "showDuration": "300",//显示的动画时间
            "hideDuration": "1000",//消失的动画时间
            "timeOut": "2000", //展现时间
            "extendedTimeOut": "1000",//加长展示时间
            "showEasing": "swing",//显示时的动画缓冲方式
            "hideEasing": "linear",//消失时的动画缓冲方式
            "showMethod": "fadeIn",//显示时的动画方式
            "hideMethod": "fadeOut" //消失时的动画方式
        };

        $.ajax({
            type: 'GET',
            url: '../Api/User/Actions',
            data: {func_url:func_url},
            beforeSend: function(request) {
                request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
            },
            dataType: "json",
            success: function (data) {
                console.info(data)
                actions=data.data;
                for(var i=0;i<actions.length;i++){
                    $('.action-'+actions[i].action_id).removeClass("layui-hide");
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                layer.msg('加载操作信息失败');
            }
        });

        //监听提交
        form.on('submit(btn_search)', function(data){
            search(data.field);
            return false;
        });


    });


    function search(params) {
        console.info(params);
        layer.load(1);
        $("#form_gw").hide();
        $("#form_feed").hide();
        $.ajax({
            type: "GET",
            url: '../Api/Device/Query',
            data: params,
            beforeSend: function(request) {
                request.setRequestHeader("Authorization", 'Bearer '+window.localStorage.getItem("token"));
            },
            dataType: "json",
            success: function (res) {
                if(res.code>=0){
                    if(res.data.type=="gw"){
                        var obj = res.data.data;
                        obj.group_area = obj.group_name+" "+obj.area_name;
                        form.val("form_gw", obj);
                        $("#form_gw").show();
                    }
                    else if(res.data.type=="feed"){
                        var obj = res.data.data;
                        obj.group_area = obj.group_name+" "+obj.area_name;
                        obj.online = obj.online>0?"在线":"离线";
                        form.val("form_feed", obj);
                        $("#form_feed").show();
                    }
                }else{
                    toastr.warning(res.msg, "错误");
                }
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                layer.msg('加载信息失败');
            },
            complete: function(XMLHttpRequest, textStatus) {
                layer.closeAll('loading');
            },

        });
    }

</script>
<script src="../js/check_screen.js?v=${.Config.basic.version}"></script>


</html>